<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Provinsi_model extends MY_Model {

    function __construct() {
        parent::__construct("provinsi", "code", Array(
            "region_code" => "Region_model"
        ));
    }

    public function findByName($name, $fetchForeign = false, $depth = 1) {
        $where = "UCASE(REPLACE(display_name, ' ', '')) LIKE UCASE(REPLACE('" . $name . "', ' ', ''))";
        $result = $this->read($where, $fetchForeign, $depth);
        $resObj = NULL;
        if (count($result) > 0) {
            $resObj = $result[0];
        }
        return $resObj;
    }

}